//
//  BaseBarButtonItem.m
//  CreditAddressBook
//
//  Created by Lee on 15/7/28.
//  Copyright (c) 2015年 Lee. All rights reserved.
//

#import "BaseBarButtonItem.h"

@implementation BaseBarButtonItem

- (instancetype)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action {
    self = [super initWithImage:image style:style target:target action:action];
    if (self) {
        [self setupAttrs];
    }
    return self;
}

- (void)awakeFromNib {
    [self setupAttrs];
}

- (void)setupAttrs {
    NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
    textAttrs[NSForegroundColorAttributeName] = CYNaviTitleColor;
    textAttrs[NSFontAttributeName] = [UIFont systemFontOfSize:14];
    [self setTitleTextAttributes:textAttrs forState:UIControlStateNormal];
    
    self.imageInsets = UIEdgeInsetsMake(self.image.size.height/3 - 3, self.image.size.width/3, 3, 0);
}

@end
